import service from "@/api/index.js";
import qs from 'qs'
const userApi = {
    //修改
    update(user){
        return service.put("/user",user);
    },
    //条件查询
    selectByPage(condition,pageNum,pageSize){
        condition.pageNum = pageNum;
        condition.pageSize = pageSize;
        return service.get("/user",{
            params:condition
        });
    },
    //根据id查询
    selectById(id){
        return service.get(`/user/${id}`);
    },
    //修改所有密码
    updateAllPassword(id,password,payPassword){

        return service.get("/user/allpassword",{
            params:{
                id,
                password,
                payPassword
            }
        })
    },
    //修改状态
    updateStatus(user){
        return service.put("/user/status",user);
    },
    //获取验证码
    captcha(){
        return service.get("/user/captcha")
    },
    //注册
    reg(user){
        return service.post("/user/reg",qs.stringify(user))
    },
    //登录
    login(user){
        return service.post("/user/login",qs.stringify(user))
    },
    //获取用户信息
    getInfo(){
        return service.get("/user/info");
    },
    //修改登陆密码
    updatePassword(chgPwdObj){
        return service.put("/user/password",qs.stringify(chgPwdObj))
    },
    //修改支付密码
    updatePayPassword(chgPayPwdObj){
        return service.put("/user/payPwd",qs.stringify(chgPayPwdObj))
    },
    //充值
    recharge(sumObj){
        return service.put("/user/recharge",qs.stringify(sumObj))
    }
};
export default userApi;